package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.NovelMapper;
import com.ruoyi.system.domain.Novel;
import com.ruoyi.system.service.INovelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 小说Service业务层处理
 * 
 * @author 许雅萍
 * @date 2024-11-16
 */
@Service
public class NovelServiceImpl extends ServiceImpl<NovelMapper,Novel> implements INovelService

{
    @Autowired
    private NovelMapper novelMapper;

    /**
     * 查询小说
     * 
     * @param novelId 小说主键
     * @return 小说
     */
    @Override
    public Novel selectNovelByNovelId(Long novelId)
    {
        return novelMapper.selectNovelByNovelId(novelId);
    }

    /**
     * 查询小说列表
     * 
     * @param novel 小说
     * @return 小说
     */
    @Override
    public List<Novel> selectNovelList(Novel novel)
    {
        return novelMapper.selectNovelList(novel);
    }

    /**
     * 新增小说
     * 
     * @param novel 小说
     * @return 结果
     */
    @Override
    public int insertNovel(Novel novel)
    {
        novel.setCreateTime(DateUtils.getNowDate());
        return novelMapper.insertNovel(novel);
    }

    /**
     * 修改小说
     * 
     * @param novel 小说
     * @return 结果
     */
    @Override
    public int updateNovel(Novel novel)
    {
        novel.setUpdateTime(DateUtils.getNowDate());
        return novelMapper.updateNovel(novel);
    }

    /**
     * 批量删除小说
     * 
     * @param novelIds 需要删除的小说主键
     * @return 结果
     */
    @Override
    public int deleteNovelByNovelIds(String novelIds)
    {
        return novelMapper.deleteNovelByNovelIds(Convert.toStrArray(novelIds));
    }

    /**
     * 删除小说信息
     * 
     * @param novelId 小说主键
     * @return 结果
     */
    @Override
    public int deleteNovelByNovelId(Long novelId)
    {
        return novelMapper.deleteNovelByNovelId(novelId);
    }
}
